//
//  EquipmentModel.m
//  CarLifes
//
//  Created by yu on 2017/8/8.
//  Copyright © 2017年 jpas. All rights reserved.
//

#import "EquipmentModel.h"

@implementation EquipmentModel

+ (NSDictionary *)mj_replacedKeyFromPropertyName
{
    return @{@"pointModel":@"point"};
}

+ (NSDictionary *)mj_objectClassInArray
{
    return @{@"pointModel":[PointModel class]};
}

#pragma mark - compare

- (NSUInteger)hash
{
    NSString *toHash = [NSString stringWithFormat:@"%.5F%.5F%ld", self.coordinate.latitude, self.coordinate.longitude, (long)self.count];
    return [toHash hash];
}

- (BOOL)isEqual:(id)object
{
    return [self hash] == [object hash];
}

#pragma mark - Life Cycle

- (id)initWithCoordinate:(CLLocationCoordinate2D)coordinate count:(NSInteger)count
{
    self = [super init];
    if (self)
    {
        _coordinate = coordinate;
        _count = count;
        _pois  = [NSMutableArray arrayWithCapacity:count];
    }
    return self;
}

- (id)mj_newValueFromOldValue:(id)oldValue property:(MJProperty *)property
{
    if (oldValue == [NSNull null]) {
        if ([oldValue isKindOfClass:[NSArray class]]) {
            return @[];
        } else if ([oldValue isKindOfClass:[NSDictionary class]]) {
            return @{};
        } else {
            return @"";
        }
    }
    return oldValue;
}

@end

@implementation PointModel

@end

@implementation EquipStatusCount

@end
